//
//  MyNavigationController.swift
//  globalcarbusiness
//
//  Created by dongzhenyu on 2017/7/3.
//  Copyright © 2017年 dongzhenyu. All rights reserved.
//

import UIKit

class MyNavigationController: UINavigationController, UINavigationControllerDelegate {

    override func viewDidLoad() {
        super.viewDidLoad()
        
        navigationBar.barTintColor = UIColor(r: 0, g: 184, b: 255)
        navigationBar.barStyle = .black
        navigationBar.titleTextAttributes = [NSForegroundColorAttributeName: UIColor.black, NSFontAttributeName: UIFont.systemFont(ofSize: 15)]
        
        delegate = self
    }
    
    func navigationController(_ navigationController: UINavigationController, willShow viewController: UIViewController, animated: Bool) {
        viewController.navigationItem.backBarButtonItem = UIBarButtonItem.init(title: "", style: UIBarButtonItemStyle.plain, target: self, action: #selector(self.backBarButtonItemAction))
    }
    
    func backBarButtonItemAction() -> Void {
        popViewController(animated: true)
    }

}
